home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / OWLINC.PAK / TINYCAPT.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  4KB  |  113 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1992, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.5  $
  6. //
  7. //----------------------------------------------------------------------------
  8. #if !defined(OWL_TINYCAPT_H)
  9. #define OWL_TINYCAPT_H
  10.  
  11. #if !defined(OWL_WINDOW_H)
  12. # include <owl/window.h>
  13. #endif
  14.  
  15. #if defined(BI_NAMESPACE)
  16. namespace OWL {
  17. #endif
  18.  
  19. class _OWLCLASS TFont;
  20.  
  21. // Generic definitions/compiler options (eg. alignment) preceeding the 
  22. // definition of classes
  23. #include <services/preclass.h>
  24.  
  25. //
  26. // class TTinyCaption
  27. // ~~~~~ ~~~~~~~~~~~~
  28. class _OWLCLASS TTinyCaption : public virtual TWindow {
  29.   protected:
  30.     TTinyCaption();
  31.    ~TTinyCaption();
  32.  
  33.     // Pass closeBox=true to replace SystemMenu box with a box that will 
  34.     // close window when clicked
  35.     // Used for floating palettes, etc.
  36.     //
  37.     void        EnableTinyCaption(int ch=58, bool closeBox=false);
  38.  
  39.     // Controller class must handle events that call these mixin handlers
  40.     //
  41.     TEventStatus DoNCHitTest(TPoint& screenPt, uint& evRes);
  42.     TEventStatus DoNCPaint();
  43.     TEventStatus DoNCCalcSize(bool calcValidRects, 
  44.                               NCCALCSIZE_PARAMS far& calcSize, uint& evRes);
  45.     TEventStatus DoNCLButtonDown(uint hitTest, TPoint& screenPt);
  46.     TEventStatus DoMouseMove(uint hitTest, TPoint& screenPt);
  47.     TEventStatus DoLButtonUp(uint hitTest, TPoint& screenPt);
  48.     TEventStatus DoNCActivate(bool active, bool& evRes);
  49.     TEventStatus DoCommand(uint id, HWND hWndCtl, uint notifyCode, TResult& evRes);
  50.     TEventStatus DoSysCommand(uint cmdType, TPoint& p);
  51.  
  52.     void        PaintButton(TDC& dc, TRect& boxRect, bool pressed);
  53.     void        PaintCloseBox(TDC& dc, TRect& boxRect, bool pressed);
  54.     void        PaintSysBox(TDC& dc, TRect& boxRect, bool pressed);
  55.     void        PaintMinBox(TDC& dc, TRect& boxRect, bool pressed);
  56.     void        PaintMaxBox(TDC& dc, TRect& boxRect, bool pressed);
  57.     void        PaintCaption(bool active);
  58.     void        DoSysMenu();
  59.  
  60.     TRect       GetCaptionRect();  // Get caption area for hit test or paint
  61.     TRect       GetSysBoxRect();   // Same for close box
  62.     TRect       GetMinBoxRect();
  63.     TRect       GetMaxBoxRect();
  64.  
  65.     uint        EvNCHitTest(TPoint& screenPt);
  66.     uint        EvNCCalcSize(bool calcValidRects, NCCALCSIZE_PARAMS far& calcSize);
  67.     void        EvNCLButtonDown(uint hitTest, TPoint& screenPt);
  68.     void        EvMouseMove(uint hitTest, TPoint& screenPt);
  69.     void        EvLButtonUp(uint hitTest, TPoint& screenPt);
  70.     bool        EvNCActivate(bool active);
  71.     TResult     EvCommand(uint id, HWND hWndCtl, uint notifyCode);
  72.     void        EvSysCommand(uint cmdType, TPoint& p);
  73. #if defined(BI_PLAT_WIN32)
  74.     void     EvNCPaint(HRGN);
  75. #else
  76.     void     EvNCPaint();
  77. #endif //BI_PLAT_WIN32
  78.  
  79.  
  80.   protected_data:
  81.     // Cache system metrics 
  82.     //
  83.     TSize    Border;        // Thin frame border size for dividers
  84.     TSize    Frame;         // Actual Left and Right, Top and Bottom frame size
  85.  
  86.     bool     CloseBox;      // True for special close box
  87.     bool     TCEnabled;
  88.     int      CaptionHeight;
  89.     TFont*   CaptionFont;   // Tiny font for caption bar
  90.     uint     DownHit;       // Mouse down hit test result
  91.     bool     IsPressed;     // Is a button currently pressed
  92.     bool     WaitingForSysCmd;
  93.  
  94.   private:
  95.     // Hidden to prevent accidental copying or assignment
  96.     //
  97.     TTinyCaption(const TTinyCaption&);
  98.     TTinyCaption& operator =(const TTinyCaption&);
  99.  
  100.   DECLARE_RESPONSE_TABLE(TTinyCaption);
  101.   DECLARE_STREAMABLE(_OWLCLASS, TTinyCaption, 1);
  102. };
  103.  
  104. // Generic definitions/compiler options (eg. alignment) following the 
  105. // definition of classes
  106. #include <services/posclass.h>
  107.  
  108. #if defined(BI_NAMESPACE)
  109. } // namespace OWL
  110. #endif
  111.  
  112. #endif  // OWL_TINYCAPT_H
  113.